import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import Framework.*;


public class win_mainWindow extends pnl_Ancestor implements ActionListener{

	btn_Ancestor btn_OpenMediaWindow 		= new btn_Ancestor("Music");
	btn_Ancestor btn_OpenNavWindow			= new btn_Ancestor("Navigation");
	btn_Ancestor btn_OpenScratchWindow 		= new btn_Ancestor("ScratchPad");
	btn_Ancestor btn_OpenUtilitiesWindow 	= new btn_Ancestor("Utilities");
	
	
	public win_mainWindow(){
		super(); // Remember to always call super on JPanel_Anc constructors!
		// By default JPanel_Anc will set the layout manager to null. this allows setBounds() 
		// to do what it's told (Sometimes it doesnt with layout managers.). 
		// Feel free to add your own JFrame *inside* this one, and use a layout manager in that.
		// it'll void your warentee though because I don't get them : / 
		
		
		// Setting coordinates and size of Buttons.
		// Coordinates are (1,2,3,4) where 1 is horizontal begin, 2 is verticle begin
		// 								   3 is horizontal end	  4 is verticle end.
		btn_OpenMediaWindow.setBounds(150,150,200,200);	
		btn_OpenNavWindow.setBounds(400,150,200,200);
		btn_OpenScratchWindow.setBounds(650, 150, 200, 200);
		btn_OpenUtilitiesWindow.setBounds(150, 400, 200, 200);
		
		// Adding buttons to event handler.
		btn_OpenMediaWindow.addActionListener(this);
		btn_OpenNavWindow.addActionListener(this);
		btn_OpenScratchWindow.addActionListener(this);
		btn_OpenUtilitiesWindow.addActionListener(this);

		// Adding buttons to view
		this.add(btn_OpenMediaWindow);
		this.add(btn_OpenUtilitiesWindow);
		this.add(btn_OpenNavWindow);
		this.add(btn_OpenScratchWindow);
		
	}
	
	public void actionPerformed(ActionEvent e) {
		
		Object actionSource = (btn_Ancestor) e.getSource();
		
		if (actionSource.equals(btn_OpenMediaWindow)){
			enterSubMenu(TeamRocket.w_Media);
		} else if (actionSource.equals(btn_OpenNavWindow)){
			enterSubMenu(TeamRocket.w_MapExample);
		} else if (actionSource.equals(btn_OpenScratchWindow)){
			enterSubMenu(TeamRocket.w_Scratchpad);
		} else if (actionSource.equals(btn_OpenUtilitiesWindow)){
			enterSubMenu(TeamRocket.w_Utilities);
		} 
	}
}
